package com.fy.dao;

import com.fy.entity.Forum_info;
import org.apache.ibatis.annotations.*;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
public interface Forum_infoMapper {
    @Select("select * from forum_info")
    List<Forum_info> findAll();
    @Select("select * from  forum_info where for_id=#{for_id}")
    List<Forum_info> getInfo(@Param("for_id") String for_id);
    @Insert("INSERT into forum_info(for_id,info_id,for_type,for_title,for_info,for_pic,for_like,for_collection,for_comments)values " +
            "(#{for_id},#{info_id},#{for_type},#{for_title},#{for_info},#{for_pic},#{for_like}," +
            "#{for_collection},#{for_comments})")
    int insert_forum_info(@Param("for_id") String for_id,@Param("info_id") String info_id,@Param("for_type") String for_type,
                          @Param("for_title") String for_title,@Param("for_info") String for_info,@Param("for_pic") String for_pic,
                          @Param("for_like") int for_like,@Param("for_collection") int for_collection,
                          @Param("for_comments") String for_comments);
    @Delete("DELETE from forum_info where for_id = #{for_id}")
    int delete_forum_info(@Param("for_id") String for_id);

    @Update("UPDATE  forum_info set for_like=#{for_like},for_collection=#{for_collection} where  for_id=#{for_id}")
    int update_forum_info(@Param("for_like") int for_like,@Param("for_collection") int for_collection,
                         @Param("for_id")String for_id);
}
